<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{env('APP_NAME')}}货主端 - 登录</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/static/admin/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="/static/admin/layuiadmin/style/login.css" media="all">
    <style>
        .layui-input-block {
            margin-left: 0px;
        }

        .layui-input-block input[type=text], .layui-input-block input[type=password] {
            line-height: 40px;
            height: 40px;
        }
    </style>
</head>
<body class="login-bg">

<div class="login">
    <div class="message">货主端登录</div>
    <div id="darkbannerwrap"></div>

    <form action="#" method="post" class="layui-form">
        {{csrf_field()}}
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input name="phone" id="LAY-user-login-cellphone" placeholder="手机号" value="" type="text"
                       lay-verify="required"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block layui-row">
                <div class="layui-col-xs6 layui-col-sm6 layui-col-md5">
                    <input type="text" id="LAY-user-login-vercode" class="layui-input" name="captcha"
                           lay-verify="required"
                           placeholder="短信验证码">
                </div>
                <div class="layui-col-xs6 layui-col-sm6 layui-col-md5">
                    <button type="button" class="layui-btn" id="LAY-user-getsmscode">
                        <span id="send_str">发送手机验证码</span>&nbsp;&nbsp;

                        <span id="p_djs">(<span id="djs">0</span>)</span></button>

                </div>
            </div>
        </div>
        <!--  <div class="layui-form-item">
              <div class="layui-input-block">
                  <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
              </div>
          </div>-->
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input class="loginin" value="登录" lay-submit lay-filter="login" style="width:100%;" id="login"
                       type="button">
            </div>
        </div>
    </form>
</div>

<script src="/static/admin/layuiadmin/layui/layui.js"></script>
<script src="/static/admin/layuiadmin/lib/admin.js"></script>
<script type="text/javascript">
    layui.use(['layer', 'jquery'], function () {
        var layer = layui.layer;
        $ = layui.jquery;
        $('#LAY-user-getsmscode').on('click', function () {
            var phone = $('#LAY-user-login-cellphone').val();
            if (phone == '') {
                layer.msg('手机号不能为空！', {icon: 2});
                return false;
            }
            if ($('#djs').text() != 0) {
                layer.msg('手机验证码已发送！', {icon: 2});
                return false;
            }
            $("#djs").text(60);
            $("#p_djs").show();
            //发送验证码
            $.post('{{route('send.msg.vcode')}}', {'mobile': phone}, function (datajson) {
                if (datajson.code == 0) {
                    layer.msg(datajson.msg, {icon: 6});
                    var setTime;
                    var time = parseInt($("#djs").text());
                    setTime = setInterval(function () {
                        if (time <= 0) {
                            $("#send_str").text("重新发送手机验证码");
                            $("#djs").text(0);
                            $("#p_djs").hide();
                            clearInterval(setTime);
                            return;
                        }
                        time--;
                        $("#djs").text(time);
                    }, 1000);
                } else {
                    layer.msg(datajson.msg, {icon: 5});
                }
            }, 'json');


        })
        ;

        $("#login").on('click', function () {
            $.post("{{route('owner.login')}}", {
                'phone': $("#LAY-user-login-cellphone").val(),
                'captcha': $("#LAY-user-login-vercode").val()
            }, function (result) {
                if (result.code == 0) {
                    layer.msg(result.msg, {icon: 6});
                    window.location.href = '{{route('owner.layout')}}';
                } else {
                    layer.msg(result.msg, {icon: 5})
                }
                layer.close(index);
            });
        })

    });

</script>

<!-- 底部结束 -->
</body>
</html>